CMAKE_MINIMUM_REQUIRED (VERSION 2.6)
PROJECT (Smartcam) 

# setup toolchain for cross compiling
SET ( CMAKE_SYSTEM_NAME Linux )
				
#SET ( OETMP OVEROTOP_MARK/tmp )
#SET ( OETMP $ENV{OVEROTOP}/tmp )

SET ( TOOLDIR OVERO_TOOL_MARK )
SET ( STAGEDIR OVERO_STAGE_MARK  )

SET ( CMAKE_C_COMPILER ${TOOLDIR}/arm-angstrom-linux-gnueabi-gcc )
SET ( CMAKE_CXX_COMPILER ${TOOLDIR}/arm-angstrom-linux-gnueabi-g++ )
SET ( CMAKE_C_FLAGS "-Wall -D_REENTRANT" )

SET ( CMAKE_FIND_ROOT_PATH ${STAGEDIR})

SET ( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
SET ( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )


LINK_DIRECTORIES ( ${STAGEDIR}/lib )
LINK_DIRECTORIES ( ${PROJECT_SOURCE_DIR}/../lib )

INCLUDE_DIRECTORIES ( ${STAGEDIR}/include )
INCLUDE_DIRECTORIES ( ${PROJECT_SOURCE_DIR}/../include )

SET ( EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../bin )
SET ( LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/../lib )
SET ( DOC_OUTPUT_PATH ${CMAKE_BINARY_DIR}/../doc )

#ADD_SUBDIRECTORY (src)

OPTION( BUILD_HELLO_WORLD "Build hello world program" ON )
OPTION( BUILD_HELLO_LIB "Build hello world library" ON )
OPTION( BUILD_BT_TEST "Build bluetooth test program" ON )
OPTION( BUILD_CV_TEST "Build OpenCV test program" ON )


IF(BUILD_BT_TEST)
	ADD_SUBDIRECTORY ( bt-test )
ENDIF()

IF(BUILD_CV_TEST)
	ADD_SUBDIRECTORY ( cv-test )
ENDIF()

IF(BUILD_BT_TEST)
	ADD_SUBDIRECTORY ( bt-scan )
ENDIF()

ADD_CUSTOM_TARGET ( deploy
				COMMAND echo "Uploading binary files on Overo" 
				COMMAND scp -o ConnectTimeout=5 -r bin root@OVERO_IP_MARKER:
				WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/.. )
				
ADD_CUSTOM_TARGET ( send_data
				COMMAND echo "Uploading data on Overo" 
				COMMAND scp -o ConnectTimeout=5 -r data root@OVERO_IP_MARKER:
				WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/.. )

